package com.stone.framework.user.entity;

import javax.persistence.Column;
import javax.persistence.Entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.stone.framework.core.entity.CommonEntity;
import com.stone.framework.core.util.Strings;

@TableName("ST_USER")
@Entity(name = "ST_USER")
public class User extends CommonEntity {

    private static final long serialVersionUID = -4702900583173226412L;

    @TableField("NAME")
    @Column(name = "NAME")
    private String name;

    @TableField("CNAME")
    @Column(name = "CNAME")
    private String cname;

    @TableField("PASSWORD")
    @Column(name = "PASSWORD")
    private String password;

    @TableField("SALT")
    @Column(name = "SALT")
    private String salt;

    @TableField("MOBILE")
    @Column(name = "MOBILE")
    private String mobile;

    @TableField("EMAIL")
    @Column(name = "EMAIL")
    private String email;

    @TableField("WECHAT")
    @Column(name = "WECHAT")
    private String wechat;

    @TableField("DEPT_CODE")
    @Column(name = "DEPT_CODE")
    private String deptCode;

    @TableField("STATE")
    @Column(name = "STATE")
    private State state;

    public static enum State {
        DISABLED, ENABLED;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getCname() {
        return cname;
    }

    public void setCname(String cname) {
        this.cname = cname;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getSalt() {
        return salt;
    }

    public void setSalt(String salt) {
        this.salt = salt;
    }

    public String getMobile() {
        return mobile;
    }

    public void setMobile(String mobile) {
        this.mobile = mobile;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getWechat() {
        return wechat;
    }

    public void setWechat(String wechat) {
        this.wechat = wechat;
    }

    public String getDeptCode() {
        return deptCode;
    }

    public void setDeptCode(String deptCode) {
        this.deptCode = deptCode;
    }

    public String getState() {
        return state == null ? null : state.name();
    }

    public void setState(String state) {
        this.state = Strings.isEmpty(state) ? null : State.valueOf(state);
    }

    @Override
    public String toString() {
        return "User [name=" + name + ", cname=" + cname + ", password=" + password + ", salt=" + salt + ", mobile="
            + mobile + ", email=" + email + ", wechat=" + wechat + ", state=" + state + ", toString()="
            + super.toString() + "]";
    }

}
